package com.intelligent.system.auth.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.intelligent.system.auth.entity.Organization;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 组织机构Mapper接口
 */
@Mapper
public interface OrganizationMapper extends BaseMapper<Organization> {
    
    /**
     * 根据父级ID查询组织机构列表
     */
    @Select("SELECT * FROM sys_organization WHERE parent_id = #{parentId} ORDER BY sort_order ASC")
    List<Organization> selectByParentId(@Param("parentId") Long parentId);

    /**
     * 根据组织机构编码查询组织机构
     */
    @Select("SELECT * FROM sys_organization WHERE org_code = #{orgCode}")
    Organization selectByOrgCode(@Param("orgCode") String orgCode);
} 